home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / devsta32.arc / DEVSTA32.ASM < prev    next >
Assembly Source File  |  1986-11-21  |  9KB  |  237 lines

  1.               ;DEVSTA - program to list out device drivers
  2.               ; usage is: DEVSTA
  3.               ; OK in DOS 2.1-3.1 breaks in DOS 3.2
  4.               ; dissasembly by A. B. Krueger from DEVSTA.EXE
  5.               ; corrected erronious printing of device names containing '$'
  6.               ;   such as CLOCK$
  7.  
  8.               page  65,132
  9. LF            EQU   0AH
  10. CR            EQU   0DH
  11. S0000         SEGMENT
  12.               ASSUME DS:S0000,CS:S0000 
  13.  
  14.               org   100h                ;com file format
  15.              
  16. begin         proc  far 
  17.               jmp    start
  18.  
  19. L0110         EQU   $
  20. nul_msg       db    cr,lf,'Failed opening NUL '         
  21.               db    ' Device.'                          
  22.               db    cr,lf,'$'                           
  23.  
  24. release_msg   db    cr,lf,'Requires DOS Version'        
  25.               db    ' 2 or greater.'                    
  26.               db    cr,lf,'$'                           
  27.  
  28. end_msg       db    'End of device chain reached'      
  29.               DB    '.',cr,lf,'$'                       
  30.  
  31. heading_msg   db    cr,lf,'Device Driver',cr,lf         
  32.               DB    'Addr'                             
  33.               DB    '  '                                
  34.               DB    '  '                                
  35.               db    ' Attr'                             
  36.               db    ' Str '                             
  37.               db    ' Int '                             
  38.               Db    '  '                                
  39.               db    'Type'                              
  40.               DB    '  '                                
  41.               db    'Units'                             
  42.               DB    '  '                                
  43.               db    'Name'                              
  44.               DB    cr,lf,'$'  
  45. print_line:
  46. print_es      db    'XXXX'          
  47.               db    ':'             
  48. print_bx      db    'XXXX'          
  49.               db    ' '             
  50. print_attr    db    'XXXX'          
  51.               db    ' '             
  52. print_str     db    'XXXX'          
  53.               db    ' '             
  54. print_int     db    'XXXX'          
  55.               Db    '   '           
  56. print_type    db  'X '              
  57.               Db  '  '              
  58.               Db  '  '              
  59. print_units   db  'XX'              
  60.               Db  '  '              
  61.               Db  '  '              
  62. print_name    Db  'XXXXXXXX'    
  63.               db cr,lf
  64. nul_fcb       db  0,'NUL     '                              
  65.               Db  '    '                              
  66.               Dw  14 dup (0)                        
  67.  
  68. start:
  69.               MOV   AH,30h           ;get DOS release  
  70.               INT   21h                                
  71.               CMP   AL,2             ;at least DOS 2.0 
  72.               JNB   Dos_ok           ;if so, go on     
  73.  
  74.               MOV   DX,offset release_msg  
  75.               JMP   SHORT  exit_msg                
  76.  
  77. Dos_ok:       MOV   CX,AX                             
  78.               MOV   AH,0Fh            ;open FCB       
  79.               MOV   DX,OFFSET Nul_fcb 
  80. L0020:        INT   21h                               
  81.               OR    AL,AL             ;did it run     
  82. L0024:        JZ    Got_nul                           
  83.  
  84.               MOV   DX,offset nul_msg 
  85.               JMP   exit_msg                          
  86.  
  87. Got_nul:      CMP   CL,2h             ;release 2?     
  88.               JA    release_3x        
  89.  
  90. release_2:
  91.               MOV   BX,word ptr nul_fcb+0dch-0c3h    ;set es:bx for dos 2.1
  92.               MOV   ES,word ptr nul_fcb+0deh-0c3h    
  93.               JMP   release_join                     
  94.  
  95. release_3x:
  96.               cmp  ch,10h
  97.               ja   release_32
  98.  
  99.               MOV   BX,word ptr nul_fcb+0ddh-0c3h    ;set es:bx for dos 3.1
  100.               MOV   ES,word ptr nul_fcb+0dfh-0c3h    
  101.               JMP   release_join                     
  102.  
  103. release_32:
  104.               mov   BX,48h    ;set es:bx for dos 3.2
  105.               MOV   ES,word ptr nul_fcb+1Ch
  106.               JMP   release_join                     
  107.  
  108. release_join:
  109.  
  110.               CALL  Type_heading   
  111.  
  112. Dev_loop:
  113.               CALL  Format_dev                          
  114.               LES   BX,DWORD PTR ES:[BX] ;get next pointer 
  115.               CMP   BX,-1                ;end of chain? 
  116.               JNZ   dev_loop     
  117.  
  118.               MOV   DX,OFFSET End_msg                   
  119.  
  120. exit_msg:     MOV   AH,9h                            
  121.               INT   21h                              
  122.               int   20h                              
  123.  
  124. begin         endp
  125.                                                      
  126. Type_heading  proc  near
  127.               MOV   DX,OFFSET heading_msg ;l005f     
  128.               MOV   AH,9                             
  129.               INT   21h                              
  130.               RET                                    
  131. type_heading  endp
  132.  
  133.                                                      
  134. Format_dev    proc  near
  135.               MOV   AX,ES                            
  136.               MOV   DI,OFFSET print_es   
  137.               CALL  Bin_hex_word         
  138.               MOV   AX,BX                            
  139.               MOV   DI,OFFSET print_bx   
  140.               CALL  Bin_hex_word         
  141.               MOV   AX,ES:[BX+4h]                    
  142.               PUSH  AX                               
  143.               MOV   DI,offset print_attr 
  144.               CALL  Bin_hex_word         
  145.  
  146.               MOV   AX,ES:[BX+6h]                    
  147.               MOV   DI,offset print_str  
  148.               CALL  Bin_hex_word         
  149.  
  150.               MOV   AX,ES:[BX+8h]                    
  151.               MOV   DI,offset print_int  
  152.               CALL  Bin_hex_word         
  153.  
  154.               POP   AX                               
  155.               TEST  AX,8000h                         
  156.               JNZ   format_only                
  157.  
  158.               MOV   word ptr print_name,0d0ah 
  159.               MOV   AL,ES:[BX+0Ah]             
  160.               AAM                              
  161.               ADD   AX,'00'                    
  162.               MOV   print_units+1,al         
  163.               MOV   print_units,ah           
  164.               MOV   BYTE PTR print_type,'B'  
  165.               MOV   cx,print_name+2-print_line
  166.               JMP   Format_print             
  167. format_only:
  168.               XOR   SI,SI                      
  169. format_type:
  170.               MOV   AL,ES:[BX+SI+0Ah]          
  171.               MOV   [SI+offset print_name],AL  
  172.               INC   SI                         
  173.               CMP   SI,08h                     
  174.               JNZ   format_type                
  175.  
  176.               MOV   WORD PTR print_units,'  '  
  177.               MOV   BYTE PTR print_type,'C'    
  178.               MOV   cx,print_name+10-print_line
  179.  
  180. Format_print: 
  181.               mov   si,offset print_line
  182. format_loop:
  183.               lodsb
  184.               mov   dl,al
  185.               MOV   AH,6            ;type on console           
  186.               INT   21h 
  187.               loop  format_loop         
  188.  
  189.               RET                              
  190. format_dev    endp
  191.  
  192.                                                
  193. Bin_hex_word  proc  near
  194.               PUSH  AX                         
  195.               MOV   AL,AH                      
  196.               CALL  Bin_hex_byte 
  197. L00DD:        ADD   DI,2                       
  198.               POP   AX                         
  199.               CALL  Bin_hex_byte 
  200.               RET                              
  201. bin_hex_word  endp
  202.  
  203.                                                
  204. Bin_hex_byte  proc  near
  205.               MOV   AH,AL                      
  206.               MOV   CX,4                       
  207.               SHR   AL,CL                      
  208.               CALL  Bin_hex_nibl 
  209.               MOV   [DI],AL                    
  210.               MOV   AL,AH                      
  211.               AND   AL,0Fh                     
  212.               CALL  Bin_hex_nibl 
  213.               MOV   [DI+1],AL                  
  214.               RET                              
  215. bin_hex_byte  endp
  216.  
  217.  
  218. Bin_hex_nibl  proc  near
  219.               ADD   AL,30h   ;'0'              
  220.               CMP   AL,39h   ;'9'              
  221.               JLE   L0104                      
  222.               ADD   AL,7                       
  223.                                                
  224. L0104:        
  225.               RET  
  226. bin_hex_nibl  endp
  227.  
  228. s0000         ends
  229. END           begin
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.